package com.jt.www.admin.stats.controller;

import com.jt.www.admin.stats.service.BigScreenStatsService;
import com.jt.www.annotations.AddHeader;
import com.jt.www.model.reps.ResultDTO;
import com.jt.www.model.vo.stats.bigscreen.accidenttype.AccTypeParamVO;
import com.jt.www.model.vo.stats.bigscreen.closecase.CloseCaseParamVO;
import com.jt.www.model.vo.stats.bigscreen.incidentrate.IncidentRateParamVO;
import com.jt.www.model.vo.stats.bigscreen.insrate.InsRateParamVO;
import com.jt.www.model.vo.stats.bigscreen.riskperiod.RiskPeriodParamVO;
import com.jt.www.model.vo.stats.bigscreen.schoolrisk.SchoolRiskParamVo;
import com.jt.www.model.vo.stats.bigscreen.schoolriskhide.SchoolRiskHiddenParamVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author admin_ltf
 * @create 2019-05-18 19:19
 */
@Api(value = "大屏统计接口", tags = {"BIG-SCREEN-API"}, description = "大屏统计接口")
@RestController
@RequestMapping(value = "/stats/screen")
public class BigScreenStatsController {

    public static final Logger log = LoggerFactory.getLogger(BigScreenStatsController.class);
    @Autowired
    private BigScreenStatsService bigScreenStatsService;

    /**
     * 事故类型占比报表-实责险
     * @param vo
     * @return
     */
    @ApiOperation(value = "事故类型占比报表-实责险",notes = "事故类型占比报表-实责险",httpMethod = "POST")
    @PostMapping(value = "/getSzxPro")
    public ResultDTO<Map<String,Object>> searchSzxAccidentTypePro(@RequestBody AccTypeParamVO vo ) {


        ResultDTO resultMap = bigScreenStatsService.searchSzxAccidentTypePro(vo);


        return resultMap;
    }

    /**
     * 事故类型占比报表-校责险
     * @param vo
     * @return
     */
    @ApiOperation(value = "事故类型占比报表-校责险",notes = "事故类型占比报表-校责险",httpMethod = "POST")
    @PostMapping(value = "/getXzxPro")
    public ResultDTO<Map<String,Object>> searchXzxAccidentTypePro(@RequestBody AccTypeParamVO vo ) {


        ResultDTO resultMap = bigScreenStatsService.searchXzxAccidentTypePro(vo);


        return resultMap;
    }

    /**
     * 出险时段占比报表-实责险
     * @param vo
     * @return
     */
    @ApiOperation(value = "出险时段占比报表-实责险",notes = "出险时段占比报表-实责险",httpMethod = "POST")
    @PostMapping(value = "/getSzxRiskTime")
    public ResultDTO<Map<String,Object>> searchSzxRiskPeriod(@RequestBody RiskPeriodParamVO vo ) {


        ResultDTO resultMap = bigScreenStatsService.searchSzxRiskPeriod(vo);


        return resultMap;
    }

    /**
     * 出险时段占比报表-校责险
     * @param vo
     * @return
     */
    @ApiOperation(value = "出险时段占比报表-校责险",notes = "出险时段占比报表-校责险",httpMethod = "POST")
    @PostMapping(value = "/getXzxRiskTime")
    public ResultDTO<Map<String,Object>> searchXzxRiskPeriod(@RequestBody RiskPeriodParamVO vo ) {


        ResultDTO resultMap = bigScreenStatsService.searchXzxRiskPeriod(vo);


        return resultMap;
    }

//    投保率报表  InsRateParamVO

    @ApiOperation(value = "投保率报表",notes = "投保率报表",httpMethod = "POST")
    @PostMapping(value = "/getInsRate")
    public ResultDTO<Map<String,Object>> searchInsRateInfo(@RequestBody InsRateParamVO vo ) {


        ResultDTO resultMap = bigScreenStatsService.searchInsRateInfo(vo);


        return resultMap;
    }

    //    结案率报表  CloseCaseParamVO   CloseCaseResultVO
    @ApiOperation(value = "结案率报表",notes = "结案率报表",httpMethod = "POST")
    @PostMapping(value = "/getCloseCasePer")
    public ResultDTO<Map<String,Object>> searchCloseCasePer(@RequestBody CloseCaseParamVO vo ) {


        ResultDTO resultMap = bigScreenStatsService.searchCloseCasePer(vo);


        return resultMap;
    }

    // 当（历）年事故发生率报表	IncidentRateParamVO   IncidentRateResultVO
    @ApiOperation(value = "当（历）年事故发生率报表",notes = "当（历）年事故发生率报表",httpMethod = "POST")
    @PostMapping(value = "/getIncidentRate")
    public ResultDTO<Map<String,Object>> searchIncidentRate(@RequestBody IncidentRateParamVO vo ) {


        ResultDTO resultMap = bigScreenStatsService.searchIncidentRate(vo);


        return resultMap;
    }

    // 校园风险事故报表 SchoolRiskParamVo  SchoolRiskResultVo
    @ApiOperation(value = "校园风险事故报表",notes = "校园风险事故报表",httpMethod = "POST")
    @PostMapping(value = "/getSchoolRisk")
    public ResultDTO<Map<String,Object>> searchSchoolRisk(@RequestBody SchoolRiskParamVo vo ) {

        ResultDTO resultMap = bigScreenStatsService.searchSchoolRisk(vo);

        return resultMap;
    }

    // 校园风险隐患报表 SchoolRiskHiddenParamVO  SchoolRiskHiddenResultVO
    @ApiOperation(value = "校园风险隐患报表",notes = "校园风险隐患报表",httpMethod = "POST")
    @PostMapping(value = "/getSchRiskHide")
    public ResultDTO<Map<String,Object>> searchSchRiskHide(@RequestBody SchoolRiskHiddenParamVO vo ) {

        ResultDTO resultMap = bigScreenStatsService.searchSchRiskHide(vo);

        return resultMap;
    }

    /**
     * 启东数据大屏-中心-投保数据
     * @param conditions
     * @return
     */
    @AddHeader
    @ApiOperation(value = "启东数据大屏-中心-投保数据",notes = "启东数据大屏-中心-投保数据",httpMethod = "POST")
    @PostMapping(value = "/insDate")
    public ResultDTO<Map<String,Object>> insDate(@RequestBody Map<String, String> conditions) {

        ResultDTO resultMap = bigScreenStatsService.insData(conditions);

        return resultMap;
    }
}
